local skel = fk.CreateSkill{
  name = "golden_cymbals_skill",
}
local isAlly = function (player, target)
  if player == target then
    return false
  end
  local role1, role2 = player.role, target.role
  local dict = { "lord", "loyalist" }
  return role1 == role2 or (table.contains(dict, role1) and table.contains(dict, role2))
end
Fk:loadTranslationTable{
  ["golden_cymbals_skill"] = "金铙",
  [":golden_cymbals_skill"] = "金铙",
  ["#golden_cymbals_skill"] = "与队友各获得一个“金”",
  ["@golden_cymbals"] = "金",
}
---@type CardSkillSpec
local golden_cymbals = {
  prompt = "#golden_cymbals_skill",
  mod_target_filter = Util.TrueFunc,
  can_use = function (self, player, card, extra_data)
    return not player:isProhibited(player, card) or table.find(Fk:currentRoom().alive_players, function (p)
      return p ~= player and not player:isProhibited(p, card) and isAlly(player, p)
    end)
  end,
  on_use = function (self, room, cardUseEvent)
    local from = cardUseEvent.from
    cardUseEvent:removeAllTargets()
    for _, p in ipairs(room.alive_players) do
      if from:canUseTo(cardUseEvent.card, p, cardUseEvent.extra_data) and (isAlly(from, p) or p == from) then
        cardUseEvent:addTarget(p)
      end
    end
  end,
  on_effect = function(self, room, effect)
    if effect.to.dead then return end
    room:addPlayerMark(effect.to, "@golden_cymbals", 1)
    if not room:hasSkill("golden_cymbals_skill_delay") then
      room:addSkill("golden_cymbals_skill_delay")
    end
  end,
}
skel:addEffect("cardskill", golden_cymbals)
return skel